import storage from "../../utils/storage/index.js"

export default {
    state: {
        // 站点信息
        siteInfo: storage.data.get("DATA_SITE_INFO") || {},
        // 站点配置
        siteConfig: storage.data.get("DATA_SITE_CONFIG") || {},
        // 站点数据统计
        siteCount: storage.data.get("DATA_SITE_COUNT") || {},
        // 站点作者信息
        authorInfo: storage.data.get("DATA_AUTHOR_INFO") || {},
        // 弹出层记录列表
        consoleRecordList: storage.data.get("DATA_CONSOLE_RECORD_LIST") || [],
        // 弹出层标签列表
        consoleTagList: storage.data.get("DATA_CONSOLE_TAG_LIST") || [],
        // 弹出层评论列表
        consoleTalkList: storage.data.get("DATA_CONSOLE_TALK_LIST") || [],
        // 侧边栏菜单列表
        asideMenuList: storage.data.get("DATA_ASIDE_MENU_LIST") || [],
        // 导航栏菜单列表
        navigationMenuList: storage.data.get("DATA_NAVIGATION_MENU_LIST") || [],
        // 图标菜单列表
        iconMenuList: storage.data.get("DATA_ICON_MENU_LIST") || [],
        // 底部菜单列表
        normalMenuList: storage.data.get("DATA_NORMAL_MENU_LIST") || [],
        // 友链菜单列表
        friendMenuList: storage.data.get("DATA_FRIEND_MENU_LIST") || [],
        // 侧边栏文章分类列表
        asideCategoryList: storage.data.get("DATA_ASIDE_CATEGORY_LIST") || [],
        // 侧边栏文章列表
        asidePostList: storage.data.get("DATA_ASIDE_POST_LIST") || [],
        // 侧边栏提示信息列表
        asideMessageList: storage.data.get("DATA_ASIDE_MESSAGE_LIST") || [],
        // 首页每日一说列表
        indexSayList: storage.data.get("DATA_INDEX_SAY_LIST") || [],
        // 首页轮播图列表
        indexBanner: storage.data.get("DATA_INDEX_BANNER") || [],
        // 首页文章分类列表
        indexCategoryList: storage.data.get("DATA_INDEX_CATEGORY_LIST") || [],
        // 首页文章列表
        indexPostList: storage.data.get("DATA_INDEX_POST_LIST") || [],
        // 首页推荐文章列表
        indexSignPostList: storage.data.get("DATA_INDEX_SIGN_POST_LIST") || [],
    },
    mutations: {
        SET_SITE_INFO(state, siteInfo) {
            state.siteInfo = siteInfo;
            storage.data.set("DATA_SITE_INFO", state.siteInfo);
        },
        SET_SITE_CONFIG(state, siteConfig) {
            state.siteConfig = siteConfig;
            storage.data.set("DATA_SITE_CONFIG", state.siteConfig);
        },
        SET_AUTHOR_INFO(state, authorInfo) {
            state.authorInfo = authorInfo;
            storage.data.set("DATA_AUTHOR_INFO", state.authorInfo);
        },
        SET_SITE_COUNT(state, siteCount) {
            state.siteCount = siteCount;
            storage.data.set("DATA_SITE_COUNT", state.siteCount);
        },
        SET_CONSOLE_RECORD_LIST(state, consoleRecordList) {
            state.consoleRecordList = consoleRecordList;
            storage.data.set("DATA_CONSOLE_RECORD_LIST", state.consoleRecordList);
        },
        SET_CONSOLE_TAG_LIST(state, consoleTagList) {
            state.consoleTagList = consoleTagList;
            storage.data.set("DATA_CONSOLE_TAG_LIST", state.consoleTagList);
        },
        SET_CONSOLE_TALK_LIST(state, consoleTalkList) {
            state.consoleTalkList = consoleTalkList;
            storage.data.set("DATA_CONSOLE_TALK_LIST", state.consoleTalkList);
        },
        SET_ASIDE_MENU_LIST(state, asideMenuList) {
            state.asideMenuList = asideMenuList;
            storage.data.set("DATA_ASIDE_MENU_LIST", state.asideMenuList);
        },
        SET_NAVIGATION_MENU_LIST(state, navigationMenuList) {
            state.navigationMenuList = navigationMenuList;
            storage.data.set("DATA_NAVIGATION_MENU_LIST", state.navigationMenuList);
        },
        SET_ICON_MENU_LIST(state, iconMenuList) {
            state.iconMenuList = iconMenuList;
            storage.data.set("DATA_ICON_MENU_LIST", state.iconMenuList);
        },
        SET_NORMAL_MENU_LIST(state, normalMenuList) {
            state.normalMenuList = normalMenuList;
            storage.data.set("DATA_NORMAL_MENU_LIST", state.normalMenuList);
        },
        SET_FRIEND_MENU_LIST(state, friendMenuList) {
            state.friendMenuList = friendMenuList;
            storage.data.set("DATA_FRIEND_MENU_LIST", state.friendMenuList);
        },
        SET_ASIDE_CATEGORY_LIST(state, asideCategoryList) {
            state.asideCategoryList = asideCategoryList;
            storage.data.set("DATA_ASIDE_CATEGORY_LIST", state.asideCategoryList);
        },
        SET_ASIDE_POST_LIST(state, asidePostList) {
            state.asidePostList = asidePostList;
            storage.data.set("DATA_ASIDE_POST_LIST", state.asidePostList);
        },
        SET_ASIDE_MESSAGE_LIST(state, asideMessageList) {
            state.asideMessageList = asideMessageList;
            storage.data.set("DATA_ASIDE_MESSAGE_LIST", state.asideMessageList);
        },
        SET_INDEX_SAY_LIST(state, indexSayList) {
            state.indexSayList = indexSayList;
            storage.data.set("DATA_INDEX_SAY_LIST", state.indexSayList);
        },
        SET_INDEX_BANNER(state, indexBanner) {
            state.indexBanner = indexBanner;
            storage.data.set("DATA_INDEX_BANNER", state.indexBanner);
        },
        SET_INDEX_CATEGORY_LIST(state, indexCategoryList) {
            state.indexCategoryList = indexCategoryList;
            storage.data.set("DATA_INDEX_CATEGORY_LIST", state.indexCategoryList);
        },
        SET_INDEX_POST_LIST(state, indexPostList) {
            state.indexPostList = indexPostList;
            storage.data.set("DATA_INDEX_POST_LIST", state.indexPostList);
        },
        SET_INDEX_SIGN_POST_LIST(state, indexSignPostList) {
            state.indexSignPostList = indexSignPostList;
            storage.data.set("DATA_INDEX_SIGN_POST_LIST", state.indexSignPostList);
        },
    },
    getters: {
        getSiteInfo: (state) => {
            return state.siteInfo;
        },
        getSiteConfig: (state) => {
            return state.siteConfig;
        },
        getAuthorInfo: (state) => {
            return state.authorInfo;
        },
        getSiteCount: (state) => {
            return state.siteCount;
        },
        getConsoleRecordList: (state) => {
            return state.consoleRecordList;
        },
        getConsoleTagList: (state) => {
            return state.consoleTagList;
        },
        getConsoleTalkList: (state) => {
            return state.consoleTalkList;
        },
        getAsideMenuList: (state) => {
            return state.asideMenuList;
        },
        getNavigationMenuList: (state) => {
            return state.navigationMenuList;
        },
        getIconMenuList: (state) => {
            return state.iconMenuList;
        },
        getNormalMenuList: (state) => {
            return state.normalMenuList;
        },
        getFriendMenuList: (state) => {
            return state.friendMenuList;
        },
        getAsideCategoryList: (state) => {
            return state.asideCategoryList;
        },
        getAsidePostList: (state) => {
            return state.asidePostList;
        },
        getAsideMessageList: (state) => {
            return state.asideMessageList;
        },
        getIndexSayList: (state) => {
            return state.indexSayList;
        },
        getIndexBanner: (state) => {
            return state.indexBanner;
        },
        getIndexCategoryList: (state) => {
            return state.indexCategoryList;
        },
        getIndexPostList: (state) => {
            return state.indexPostList;
        },
        getIndexSignPostList: (state) => {
            return state.indexSignPostList;
        },
    }
}